<?php

class member_widget extends iKernel{
	public $content;
	private $title = "Member Area";
	function member_widget(){
		
			include("locale/en.php");
		
		$this->settings = new DB("settings");
		$this->settings->select();
		$this->settings->nextRecord();
		
		$tpl = new Template;
			$db = new DB("widgets");
			$db->select("widget_name='member'");
			$db->nextRecord();
		
			
		if(!iUSER){
			if($this->settings->enable_registration == "1") $reg = "<input type='button' name='register' value='".$locale['register']."' class='uiButton uiButtonSpecial' />"; else $reg = "";
		
		if(!empty($_POST['login_email'])) $email = $_POST['login_email']; else $email = "";
		if(!empty($_POST['login_password'])) $password = $_POST['login_password']; else $password = "";
		
		$this->content = "
			<form method='post' action='".$this->settings->siteurl."/login.php'>
			".$locale['email'].":<br /> <input type='text' name='login_email' value='$email' style='width: 100%;' /><br/>
			".$locale['password'].":<br />  <input type='password' name='login_password' value='$password' style='width: 100%;' /><br/>
			<input type='checkbox' id='remember_me' name='remember_me'/><label for='remember_me'>".$locale['remember']."</label><br/>
			<input type='submit' name='login' value='".$locale['login']."' class='uiButton' style='width: 70px;' /> 
			$reg
			</form>
			";
		}else{
			//$this->title =$locale['login_welcome'].$this->getUser("user_firstname", USER_ID);

			$this->content = "
			<nav id='subnav'>
				<ul>
					<li><a href='".iUrl::makeClean($relativeslash."?lang=".$current_language."&page=profile")."'>Profile</a></li>
					<li><a href='".iUrl::makeClean($relativeslash."?lang=".$current_language."&page=mailbox&argv1=inbox")."'>Mailbox</a> (0)</li>
					<li><a href='".$this->settings->siteurl."login.php?var_a=logout'>Logout</a></li>
				</ul>
			</nav>
			";
		}		
		
										
		$tpl->sidebar = "left";
		$tpl->title = $this->title;
		$tpl->content = $this->content;
		$tpl->Build("view/modules");
	}

}

?>